package com.alterzhang.userservice.mongo;


import com.mongodb.BasicDBObject;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;

public class MongoUtil {
    /*public static void main(String[] args) {
        MongoClient mongoClient = new MongoClient("localhost", 27017);
        MongoDatabase database = mongoClient.getDatabase("test");


        MongoCollection<Document> userCollection = database.getCollection("USER");

        Document document = new Document();
        document.put("name", "zsh");
        document.put("age", 18);
        userCollection.insertOne(document);


        BasicDBObject filter = new BasicDBObject();
        filter.append("name", "zsh");
        MongoCursor cursor = userCollection.find(filter).iterator();

        while (cursor.hasNext()) {
            System.out.println(cursor.next());
        }


    }*/

}
